package it.beppi.knobselector;

import android.app.ListActivity;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;

/**
 * @author Sinya
 * @editor
 * @date 11/4/2018 10:00 AM
 * @describe
 */
public class SampleListActivity extends ListActivity {

    private String[] items = {"Sample1", "Sample2", "Sample3", "Sample4", "Sample5", "Sample6", "Sample7", "Sample8", "Sample9", "Sample10"};


    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        ArrayAdapter<String> adapter = new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, items);
        setListAdapter(adapter);
        getListView().setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
                Intent intent = new Intent();

                switch (i) {
                    case 0:
                        intent = new Intent(SampleListActivity.this, SampleActivity1.class);
                        break;
                    case 1:
                        intent = new Intent(SampleListActivity.this, SampleActivity2.class);
                        break;
                    case 2:
                        intent = new Intent(SampleListActivity.this, SampleActivity3.class);
                        break;
                    case 3:
                        intent = new Intent(SampleListActivity.this, SampleActivity4.class);
                        break;
                    case 4:
                        intent = new Intent(SampleListActivity.this, SampleActivity5.class);
                        break;
                    case 5:
                        intent = new Intent(SampleListActivity.this, SampleActivity6.class);
                        break;
                    case 6:
                        intent = new Intent(SampleListActivity.this, SampleActivity7.class);
                        break;
                    case 7:
                        intent = new Intent(SampleListActivity.this, SampleActivity8.class);
                        break;
                    case 8:
                        intent = new Intent(SampleListActivity.this, SampleActivity9.class);
                        break;
                    case 9:
                        intent = new Intent(SampleListActivity.this, SampleActivity10.class);
                        break;
                    case 10:
                        intent = new Intent(SampleListActivity.this, SampleActivity6.class);
                        break;
                    default:
                        break;
                }

                startActivity(intent);
            }
        });
    }
}
